# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=eclipse-ecj
pkgver=4.26
_pkgdate=202211231800
pkgrel=0
pkgdesc="Eclipse java bytecode compiler"
url="https://www.eclipse.org/jdt/core/index.php"
# x86, armhf and armv7 blocked by openjdk17
# riscv64 blocked by java
# ppc64le: jdk17 unsupported at 4.25
arch="noarch !x86 !armv7 !armhf !riscv64 !ppc64le"
license="EPL-2.0"
depends="java-common"
makedepends="apache-ant java-jdk"
subpackages="$pkgname-doc"
source="ecjsrc-$pkgver.zip::https://archive.eclipse.org/eclipse/downloads/drops4/R-$pkgver-$_pkgdate/ecjsrc-$pkgver.jar
	ecj
 	10-jar-signature.patch
	20-javac-version.patch
	"
builddir="$srcdir"

build() {
	ant build
}

check() {
	CLASSPATH=$srcdir/ecj.jar ./ecj -v
}

package() {
	install -Dm644 "$srcdir/ecj.jar" "$pkgdir/usr/share/java/eclipse-ecj-$pkgver.jar"
	ln -s eclipse-ecj-$pkgver.jar "$pkgdir/usr/share/java/ecj.jar"
	ln -s eclipse-ecj-$pkgver.jar "$pkgdir/usr/share/java/eclipse-ecj.jar"
	install -Dm755 ecj "$pkgdir/usr/bin/ecj"
	install -D -m 644 ecj.1 "$pkgdir/usr/share/man/man1/ecj.1"
}

sha512sums="
e53534160e6a2cdc8c5db7caec617d5671eb59954a86b9dcb36a514024c3205167c8416560796ce61d1aa188f551660f3bfd8eab46fefe9111c8f0b7a977342f  ecjsrc-4.26.zip
17272b6bb21efeada37d60c1831685bc25128eddf55338807861a65c5117b37df8e18373f120f06e7488438d05750592029bf4dc9c74e38bc4159e4dc43dd2bf  ecj
1aaa946994bf0e914820f0ed91d0f1428a25acb02b967d7e267d887eefe31fd009d82660435d75834d986e44a463344b3289a73813379f2474382d5306c548aa  10-jar-signature.patch
2a9ccd4fd4d1af046fbd6c01e7cc8427b9a1ee1052078672b82094c06dc0c2ac56ba7e6d92f61e57a0333aeeea7d8ac9ef9d5e4dcd98e3cef29a10288fbe7c20  20-javac-version.patch
"
